<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>个人设置</title>
	<link rel="stylesheet" href="../css/setting.css" />
	<script type="text/javascript"  src="../js/jquery-1.11.3.js"></script>
</head>
<script>
function show(id){
	document.getElementById(id).style.display = 'block';
}
function hin(id){
	document.getElementById(id).style.display = 'none';
}
</script>
<body>
	<div class="wrap">
	<div class="logo">
		<!--头部-->
			<a href=""><img src="../images/dota2_logn.png" alt="恋尚优" /></a>
			<div class="login">
						<div class="user">
							<div class="user_img">
								<img src="../images/user.png" alt="" />
							</div>
							<div class="user_name" onmouseover="$('#user_name_none').css('display', 'block');"
								onmouseout="$('#user_name_none').css('display', 'none');">
								<a href="" id="user_name_a">
									<span>${userInfo. uName}</span> <b class="caret"></b>
								</a>
								<ul id="user_name_none">
									<li class="user_home"><a
										href="userCenter">个人主页</a></li>
									<li class="out_login"><a href="javascript:void(0)"
										id="quit"   onclick="loginOut()">退出登录</a></li>
								</ul>
							</div>
						</div>
			<!-- end -->
			</div>
		</div>
		<!--头部end-->
		<div class="bodyer">
			<div class="container">
			<!--主体内容-->
				<div class="site">
				<!-- 位置 -->
					<div class="home_icon">
						<a href="index"><img src="../images/home_icon.png" alt="" /></a>
					</div>
					<div class="triangle"></div>
					<div class="site_sp">
						<a href="userCenter">用户中心</a>
					</div>
					<div class="triangle1"></div>
					<div class="site_ss">
						个人设置
					</div>
				<!-- 位置end -->
				</div>
				<div class="container1">
					<div class="ample_container">
					<!-- 左边内容 -->
						<div class="ample_container_top">
							<ul>
								<li class="ample_container_top1"><a href="javascript:void(0)" onclick="shows(1)">个人资料设置</a></li>
								<li><a href="javascript:void(0)" onclick="shows(2)">私隐安全</a></li>
							</ul>
						</div>
						<form id="user_info">
						<div class="form_group">
						
							<div class="site_info">
								<label class="form_manage">手机号码：</label>
								<div class="site_input">
									<input type="text" value="" class="site_input1" name="tel"/>
								</div>
								
							</div>
							<div class="site_info">
								<label class="form_manage">你的邮箱：</label>
								<div class="site_input">
									<input type="text" value="${userInfo. uEmail}"  class="site_input1" name="mail"/>
								</div>
							</div>
							<div class="ample_user_bor"></div>
							<div class="btn_save">
								保存
							</div>
							<label class="form_msg"></label>
						<!-- 个人资料设置end	 -->
						</div>
						</form>
						
						<form id="user_secure" style="display: none;">
						<div class="form_group">
							<div class="site_info">
								<label class="form_manage">新密码：</label>
								<div class="site_input">
									<input type="password" value="" class="site_input1" name="pwd"/>
								</div>
							</div>
							<div class="site_info">
								<label class="form_manage">重复密码：</label>
								<div class="site_input">
									<input type="password" value=""  class="site_input1" name="rpwd"/>
								</div>
							</div>
							<div class="ample_user_bor"></div>
							<div class="btn_save1">
								重置密码
							</div>
						<!-- 个人资料设置end	 -->
						</div>
						</form>
						
					<!-- 左边内容end -->
					</div>
				<div class="user_info">
					<!-- 右边内容 -->
						<div class="user_info_img">
							<img src="../images/user.png" alt="" />
						</div>
						<div class="user_info_name">
							<p>${userInfo. uName}</p>
						</div>
						<div class="user_info_site">
							<p>
								<span class="user_info_site1">
									<img src="../images/dw.png" alt="" />
									湖南省衡阳市 电信</span>
								<span class="user_info_site2">
									<img src="../images/time.png" alt="" />
									1小时前
								</span>
							</p>
						</div>
						<div class="ample_user_bor"></div>
						<div class="user_info_sign">
							<p>你若情深我必意重，唯有不负好时光。</p>
							
						</div>
						<div class="ample_user_bor"></div>
					<!-- 右边内容end -->
					</div>
					<div class="nav_bar">
					<!-- 右边导航栏 -->
						<a href="/index.php/home/Record/index.html">
							<div class="nav_bar_1 ">
								<img src="../images/repertory.png" alt="" />
								<span>交易记录</span>
						</div>
						</a>
						<a href="/index.php/home/Setting/index.html">
							<div class="nav_bar_1">
								<img src="../images/set.png" alt="" />
								<span>个人设置</span>
							</div>
						</a>
					<!-- 右边导航栏end -->
					</div>
				</div>
			<!--主题内容end-->
			</div>
			<!-- boyder end -->
		</div>
		<div class="footer">
			<div class="footer_container">
				<p>
					<a href="/index.php/home/Index/index.html">首页</a><b>|</b>
					<a href="#">关于我们</a><b>|</b>
					<a href="#">意见反馈</a><b>|</b>
					<a href="#">商务合作</a>
				</p>
			</div>
		</div>
	</div>
</body>
</html>
<script>
	$(function(){
		var file = $(".filePrew");
			aim = $(".pic_name");
		file.on('change', function( e ){
		    var name = e.currentTarget.files[0].name;
		    aim.text( name );
		})
		$(".btn_save").click(function(){
			var formdata = new FormData($("#user_info")[0]);
			$.ajax({
				url:"../operation/updateTelById",
				data:formdata,
				type:"POST",
				processData: false,
				contentType: false,
				success:function(data){
					if(data.status == 200){
						alert("个人资料修改成功！");
						window.location.reload();
					}else{
						$(".form_msg").html(data.data);
					}
				}
			})
		})
		$(".btn_save1").click(function(){
			var formdata = new FormData($("#user_secure")[0]);
			$.ajax({
				url:"../operation/updatePwdById",
				data:formdata,
				type:"POST",
				processData: false,
				contentType: false,
				success:function(data){
					if(data.status == 200){
						alert("密码修改成功！");
						window.location.reload();
					}else{
						alert(data.data);
					}
				}
			})
		})
		$("#login_out").click(function(){
			// alert(1);
			$.ajax({
				url:"/index.php/home/Index/quit",
	            success:function(data){
	            	if(data == 1){
	            		window.location.href="/index.php/home/Index/index.html";
	            	}
	            }
			})
		})
	})
	function shows(status){
		$(".ample_container_top li").each(function(index,element){
			$(this).removeClass('ample_container_top1');
		})
		$(".ample_container_top li").each(function(index,element){
			if(status==1&&index==0){
				$(this).addClass('ample_container_top1');
			}else if(status==2&&index==1){
				$(this).addClass('ample_container_top1')
			}
			
		})
		if(status==1){
			show('user_info')
			hin('user_secure');
			return;
		}
		hin('user_info');
		show('user_secure');
	}
</script>
